// src/main/java/cn/edu/tju/elm/model/dto/TransferRequestDTO.java
package cn.edu.tju.elm.model.dto;

import java.math.BigDecimal;

public class TransferRequestDTO {
    private Long fromUserId;      // 转出用户ID
    private Long toUserId;        // 转入用户ID
    private BigDecimal amount;
    private String description;   // 转账说明
    // 移除了referenceId字段，由系统自动生成

    // 构造方法
    public TransferRequestDTO() {}

    // 验证方法
    public void validate() {
        if (fromUserId == null) {
            throw new IllegalArgumentException("转出用户ID不能为空");
        }
        if (toUserId == null) {
            throw new IllegalArgumentException("转入用户ID不能为空");
        }
        if (fromUserId.equals(toUserId)) {
            throw new IllegalArgumentException("不能向自己转账");
        }
        if (amount == null || amount.compareTo(BigDecimal.ZERO) <= 0) {
            throw new IllegalArgumentException("转账金额必须大于0");
        }
    }

    // Getter和Setter
    public Long getFromUserId() { return fromUserId; }
    public void setFromUserId(Long fromUserId) { this.fromUserId = fromUserId; }

    public Long getToUserId() { return toUserId; }
    public void setToUserId(Long toUserId) { this.toUserId = toUserId; }

    public BigDecimal getAmount() { return amount; }
    public void setAmount(BigDecimal amount) { this.amount = amount; }

    public String getDescription() { return description; }
    public void setDescription(String description) { this.description = description; }
}